package pl.cvplus.entity;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import java.util.Collection;

/**
 * Created by IntelliJ IDEA.
 * User: Piotrek
 * Date: 02.03.12
 * Time: 23:16
 * To change this template use File | Settings | File Templates.
 */
@javax.persistence.Table(name = "cp_style", schema = "public", catalog = "")
@Entity
public class CpStyle {
    private Integer id;

    @javax.persistence.Column(name = "id", nullable = false, insertable = true, updatable = true, length = 10, precision = 0)
    @Id
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    private String definition;

    @javax.persistence.Column(name = "definition", nullable = true, insertable = true, updatable = true, length = 2147483647, precision = 0)
    @Basic
    public String getDefinition() {
        return definition;
    }

    public void setDefinition(String definition) {
        this.definition = definition;
    }

    private String styleName;

    @javax.persistence.Column(name = "style_name", nullable = true, insertable = true, updatable = true, length = 2147483647, precision = 0)
    @Basic
    public String getStyleName() {
        return styleName;
    }

    public void setStyleName(String styleName) {
        this.styleName = styleName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CpStyle cpStyle = (CpStyle) o;

        if (definition != null ? !definition.equals(cpStyle.definition) : cpStyle.definition != null) return false;
        if (id != null ? !id.equals(cpStyle.id) : cpStyle.id != null) return false;
        if (styleName != null ? !styleName.equals(cpStyle.styleName) : cpStyle.styleName != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (definition != null ? definition.hashCode() : 0);
        result = 31 * result + (styleName != null ? styleName.hashCode() : 0);
        return result;
    }

    private Collection<CpCv> cpCvsById;

    @OneToMany(mappedBy = "cpStyleByStyleFk")
    public Collection<CpCv> getCpCvsById() {
        return cpCvsById;
    }

    public void setCpCvsById(Collection<CpCv> cpCvsById) {
        this.cpCvsById = cpCvsById;
    }
}
